<%--
  Created by IntelliJ IDEA.
  User: cherish
  Date: 2025/6/30
  Time: 14:40
  To change this template use File | Settings | File Templates.
--%>
https://gitee.com/cherish-junjun<%@ page contentType="text/html;charset=UTF-8" language="java"  isELIgnored="false" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
    <title>用户列表</title>
    <script type="application/javascript" src="../../js/jquery-3.6.0.js"></script>
    <script type="application/javascript">

        $(function () {
            $("#btn").click(function(){
                let pram={
                    name:"xavier",
                    age: 214
                }
                $.ajax({
                    type:"post",
                    url:"./tree.action",
                    data:pram,
                    success:function (res) {
                        document.getElementById("divDemo").textContent=res.name;



                    },
                    error: function (xhr,status,error) {
                        console.log("错误码"+status.core+",信息:"+error)

                    }

                })


            })

        })


    </script>
</head>
<body>
<table border="1"  width="500px">
    <tr><th>序号</th><th>用户名称</th><th>性别</th></tr>
    <c:forEach var="user" items="${userList}" varStatus="status">
        <tr>
            <td>${status.count}</td>
            <td>${user.name}</td>
            <td>${user.gender}</td>
        </tr>

    </c:forEach>


</table>
<div id="divDemo">

</div>
<input type="button" value="测试" id="btn" />

</body>
</html>